import urllib.request


url = 'https://www.baidu.com'

response = urllib.request.urlopen(url)
content = response.read().decode('utf-8')
print(content)

# print(response.geturl())
# print(response.getheaders())
# print(response.getcode())


# urllib.request.urlretrieve('https://www.hao123.com/?from=offline_host', 'hao123.html')
# print('下载完成')